/*
 * led_indicate.cpp
 *
 *  Created on: 09.05.2013
 *      Author: Roma Jam
 */


#include "led_indicate.h"

Led_Ind_t Led;

void Led_Ind_t::Task(){
	switch (State) {
		case lsOn:

			break;
		case lsOff:

			break;
		case lsBlink:
			if(Delay.Elapsed(&Timer, BLINK_TIME)) On();
			break;
	}
}

void Led_Ind_t::Init(){
	Red.SetupOut(LED_GPIO, REDLED_P);
	Orange.SetupOut(LED_GPIO, ORGLED_P);
	Blue.SetupOut(LED_GPIO, BLULED_P);
	CurrentColor = lcOrange;
	On();
}

void Led_Ind_t::On(){
	switch (CurrentColor) {
		case lcRed:
			Red.Hi();
			break;
		case lcOrange:
			Orange.Hi();
			break;
		case lcBlue:
			Blue.Hi();
			break;
	}
	State = lsOn;
}

void Led_Ind_t::Off(){
	switch (CurrentColor) {
		case lcRed:
			Red.Lo();
			break;
		case lcOrange:
			Orange.Lo();
			break;
		case lcBlue:
			Blue.Lo();
			break;
	}
	State = lsOff;
}
